 Write-Output $rootPath

$rootPath = Get-Location
# Write-Output $rootPath

# Retrieve all files in the current directory and its subdirectories
$files = Get-ChildItem -Path $rootPath -File -Recurse

# Create a hashtable to store file types and their counts
$fileTypes = @{}

# Iterate through each file and extract its extension
foreach ($file in $files) {
    $extension = $file.Extension

    # Skip files without extensions
    if ($extension -ne '') {
        # Increment the count for each file type
        if ($fileTypes.ContainsKey($extension)) {
            $fileTypes[$extension]++
        } else {
            $fileTypes[$extension] = 1
        }
    }
}

# Display the file types and their counts
foreach ($fileType in $fileTypes.GetEnumerator() | Sort-Object -Property Value -Descending) {
    $extension = $fileType.Key
    $count = $fileType.Value
    Write-Output "${extension}: ${count}"
}